/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package reportcenter.support.custom.exception;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.richclient.exceptionhandling.AbstractLoggingExceptionHandler;

/**
 *
 * @author renan
 */
public class InternalEventExceptionHandler extends AbstractLoggingExceptionHandler implements ApplicationContextAware{

	private ApplicationContext context = null;
	
	public void setApplicationContext(ApplicationContext context) throws BeansException {
		this.context = context;
	}

	@Override
	public void notifyUserAboutException(Thread thread, Throwable throwable) {
            System.out.println("DEU ERRO!!!!!");
		ApplicationAlertEvent event = new ApplicationAlertEvent(ApplicationAlertEvent.EventType.ERROR, 
			throwable.getLocalizedMessage(), throwable);
		context.publishEvent(event);
	}
}
